package com.shanpin.shebao.model.material;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

import org.springframework.jdbc.core.RowMapper;

import com.shanpin.shebao.model.material.constant.FlowStatus;
import com.shanpin.shebao.model.material.constant.NodeType;
import com.shanpin.shebao.model.material.constant.Source;
import com.shanpin.shebao.model.material.constant.SourceOp;
import com.shanpin.shebao.model.material.constant.SourceType;
import com.shanpin.shebao.model.material.constant.TodoFlag;

// t_sb_material_flow
public class MaterialFlow {
	  
	private int f_id;
	private Source source;
	private SourceOp source_op;
	private SourceType source_type;
	private int u_id;
	private Integer city_code;  	//参保城市，非必填
	private String user_name;	//参保人姓名,非必填
	private String id_card;			//参保人身份证，非必填
	private String buy_no;			//买单，非必填
	private FlowStatus flow_status;
	private NodeType cur_node_type;
	private TodoFlag todo_flag;
	private String memo_op;
	private Date create_time;
	private Date update_time;
	
	public static RowMapper<MaterialFlow> MAPPER = new RowMapper<MaterialFlow>() {
		@Override
		public MaterialFlow mapRow(ResultSet rs, int rowNum) throws SQLException {
			MaterialFlow m = new MaterialFlow();
			m.setF_id(rs.getInt("f_id"));
			m.setSource(Source.of(rs.getInt("source")));
			m.setSource_op(SourceOp.of(rs.getInt("source_op")));
			m.setSource_type(SourceType.of(rs.getInt("source_type")));
			m.setU_id(rs.getInt("u_id"));
			m.setCity_code(rs.getInt("city_code"));
			m.setUser_name(rs.getString("user_name"));
			m.setId_card(rs.getString("id_card"));
			m.setBuy_no(rs.getString("buy_no"));
			m.setFlow_status(FlowStatus.of(rs.getInt("flow_status")));
			m.setCur_node_type(NodeType.getNodeType(rs.getInt("cur_node_type")));
			m.setTodo_flag(TodoFlag.of(rs.getInt("todo_flag")));
			m.setMemo_op(rs.getString("memo_op"));
			m.setCreate_time(rs.getTimestamp("create_time"));
			m.setUpdate_time(rs.getTimestamp("update_time"));
			return m;
		}
	};
	public int getF_id() {
		return f_id;
	}
	public void setF_id(int f_id) {
		this.f_id = f_id;
	}
	public Source getSource() {
		return source;
	}
	public void setSource(Source source) {
		this.source = source;
	}
	public SourceOp getSource_op() {
		return source_op;
	}
	public void setSource_op(SourceOp source_op) {
		this.source_op = source_op;
	}
	public SourceType getSource_type() {
		return source_type;
	}
	public void setSource_type(SourceType source_type) {
		this.source_type = source_type;
	}
	public int getU_id() {
		return u_id;
	}
	public void setU_id(int u_id) {
		this.u_id = u_id;
	}
	public Integer getCity_code() {
		return city_code;
	}
	public void setCity_code(Integer city_code) {
		this.city_code = city_code;
	}
	public String getUser_name() {
		return user_name;
	}
	public void setUser_name(String user_name) {
		this.user_name = user_name;
	}
	public String getId_card() {
		return id_card;
	}
	public void setId_card(String id_card) {
		this.id_card = id_card;
	}
	public String getBuy_no() {
		return buy_no;
	}
	public void setBuy_no(String buy_no) {
		this.buy_no = buy_no;
	}
	public FlowStatus getFlow_status() {
		return flow_status;
	}
	public void setFlow_status(FlowStatus flow_status) {
		this.flow_status = flow_status;
	}
	public NodeType getCur_node_type() {
		return cur_node_type;
	}
	public void setCur_node_type(NodeType cur_node_type) {
		this.cur_node_type = cur_node_type;
	}
	public TodoFlag getTodo_flag() {
		return todo_flag;
	}
	public void setTodo_flag(TodoFlag todo_flag) {
		this.todo_flag = todo_flag;
	}
	public String getMemo_op() {
		return memo_op;
	}
	public void setMemo_op(String memo_op) {
		this.memo_op = memo_op;
	}
	public Date getCreate_time() {
		return create_time;
	}
	public void setCreate_time(Date create_time) {
		this.create_time = create_time;
	}
	public Date getUpdate_time() {
		return update_time;
	}
	public void setUpdate_time(Date update_time) {
		this.update_time = update_time;
	}
}
